/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.invoice.busines;

import com.invoice.busines.dto.ClienteDTO;
import com.invoice.exceptions.InvoiceException;
import com.invoice.model.dao.ClienteDAO;
import com.invoice.model.dao.ClienteDAOHibernate;
import java.util.List;

/**
 *
 * @author Lenin
 */
public class ClienteBOImpl implements ClienteBO {
    ClienteDAO clienteDAO = new ClienteDAOHibernate();
    
    @Override
    public ClienteDTO addCliente(ClienteDTO clienteDTO) throws InvoiceException {
        Integer id=(Integer) clienteDAO.add(clienteDTO);
        clienteDTO.setIdCliente(id);
        return clienteDTO;
    }

    @Override
    public void deleteCliente(ClienteDTO clienteDTO) throws InvoiceException {
        clienteDAO.delete(clienteDTO);
    }

    @Override
    public void updateCliente(ClienteDTO clienteDTO) throws InvoiceException {
        clienteDAO.update(clienteDTO);
    }

    @Override
    public ClienteDTO findCliente(String codigoCliente) throws InvoiceException {
        return clienteDAO.findCliente(codigoCliente);
    }

    @Override
    public List<ClienteDTO> findClienteAll() throws Exception {
        return clienteDAO.findAll();
    }

}
